
scores: las

las:
	grep 'Labeled *attachment score' experiments/results/*.eval | sed -e 's/experiments\/results\///g' | sort > /tmp/x
	cat /tmp/x | sed -e 's/^\([^-]*-[^-]*-[^-]*\)-.*/\1/g' | uniq | sort > /tmp/x.experiments
	for f in `cat /tmp/x.experiments` ; do \
		echo $$f; \
		grep "$${f}-" /tmp/x | sed -e 's/^[^-]*-[^-]*-[^-]*-//g' -e 's/\.eval//g' -e 's/:[^=]*=//g' -e 's/ %//g' \
			| awk '{ print $$2 " " $$1 }' | sort -nr | awk '{ print "\t" $$2 " (" $$1 ")" }' ; \
	done

uas:
	grep 'Unlabeled attachment score' experiments/results/*.eval | sed -e 's/experiments\/results\///g' | sort > /tmp/x
	cat /tmp/x | sed -e 's/^\([^-]*-[^-]*-[^-]*\)-.*/\1/g' | uniq | sort > /tmp/x.experiments
	for f in `cat /tmp/x.experiments` ; do \
		echo $$f; \
		grep "$${f}-" /tmp/x | sed -e 's/^[^-]*-[^-]*-[^-]*-//g' -e 's/\.eval//g' -e 's/:[^=]*=//g' -e 's/ %//g' \
			| awk '{ print $$2 " " $$1 }' | sort -nr | awk '{ print "\t" $$2 " (" $$1 ")" }' ; \
	done

times:
	grep 'Finished training' experiments/results/*.log | sort

features:
	grep 'features,' experiments/results/*.log | sort

confs:
	for f in `ls experiments/results/*.log` ; do \
		echo ===== $$f ===== ; \
		egrep '(IncLabMstParser|LabelledLoss|iterations1)' $$f ; \
		echo ; echo ; \
	done

test-all:
	nice nohup sh experiments/test-all > experiments/results/test-all-`date +%Y%m%d-%H%M%S`.log

test-ip-baseline:
	nice nohup sh experiments/test-ip-baseline > experiments/results/test-ip-baseline-`date +%Y%m%d-%H%M%S`.log

test-mst-baseline:
	nice nohup sh experiments/test-mst-baseline > experiments/results/test-mst-baseline-`date +%Y%m%d-%H%M%S`.log

test-ip-mst2:
	nice nohup sh experiments/test-ip-mst2 > experiments/results/test-ip-mst2-`date +%Y%m%d-%H%M%S`.log

test-ip-all:
	nice nohup sh experiments/test-ip-all > experiments/results/test-ip-all-`date +%Y%m%d-%H%M%S`.log
	
greedy-genes:
	nohup sh experiments/greedy-genes-all > experiments/results/greedy-genes-all-`date +%Y%m%d-%H%M%S`.log

greedy-genes-danish:
	nohup perl experiments/greedy-genes2 danish 15 300 > experiments/results/greedy-genes-danish-`date +%Y%m%d-%H%M%S`.log

greedy-genes-in:
	nohup perl experiments/greedy-genes-inv danish 15 286 > experiments/results/greedy-genes-`date +%Y%m%d-%H%M%S`.log

kill-greedy:
	kill `ps aux | grep greedy | grep java | awk '{ print $$2}'`

regression-genes:
	sh experiments/regression-genes
	nohup sh experiments/run > regression-genes.log

all:
	sh experiments/generate
	nohup sh experiments/run

dist.zip: dist/*
	zip -r dist.zip dist/MatrixParser.jar

compute3: dist.zip
	scp dist.zip login.isv.cbs.dk:~
	ssh login.isv.cbs.dk scp dist.zip compute3:~
	ssh login.isv.cbs.dk ssh compute3 sh ~/bin/update-incparser

clean-all:
	rm -f experiments/todo/*
	mv experiments/results experiments/results-`date +"%Y.%m.%d-%H.%M.%S"`
	mkdir -p experiments/results
	
